#include <bits/stdc++.h>
#define int long long
#define PII pair <int, int>
using namespace std;
const int N=2e4;
struct Tree {
	int node[N];
	void add(int x, int k) { for(; x < N; x += x & -x) node[x] += k; }
	int gsum(int x) { return x ? node[x] + gsum(x - (x & -x)) : 0; }
} tree;
signed main() {
//	freopen("rotate.in", "r", stdin);
//	freopen("rotate.out", "w", stdout);
	ios :: sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	srand(time(0));
	int ans=1e18,pos=-1;
	int ans2=1e18,pos2=-1;
	int n;
	cin>>n;
	for(int x=2;x<=1000;x++){
		int sum=0,score=0;
		for(int i=n;i>=1;i--){
			int old=rand()%n+1;
			old -= tree.gsum(old);
			if(old<i) {
				int len=i-old;
				sum+=len/x+len%x;
				score+=len%x;
				tree.add(old, 1);
			}
		}
		if(sum<ans){
			ans=sum;
			pos=x;
		}
		if(sum<=1.9e6&&score<ans2){
			ans2=score;
			pos2=x;
		}
	}
	cout<<"best_sum "<<pos<<' '<<ans<<'\n';
	cout<<"best_score "<<pos2<<' '<<ans2<<'\n';
	return 0;
}


